﻿using System;
using System.Drawing;
using BasicFramework.Helper;
using BasicFramework.Rendering.Buffer;
using SlimDX.Direct3D9;
using BasicFramework.Rendering.Primitives;
using BasicFramework.Rendering.Primitives.Indexes;

namespace BasicFramework.Devices
{
    public abstract class DeviceContextBase : IDisposable
    {
        #region Fields

        private int dxVersion;

        #endregion


        #region Properties

        public int DXVersion
        {
            get { return dxVersion; }
            internal set { this.dxVersion = value; }
        }

        ~DeviceContextBase()
        {
            this.Dispose(false);
        }
        #endregion


        #region Constructors

        public DeviceContextBase()
        {
            Logger.Info("Device Context created");
        }

        #endregion


        #region Events

        #endregion


        #region Methods

        internal abstract void InitializeDevice(IntPtr handle, IDeviceSettings settings);
        internal abstract void OnResize(Size size);
        internal abstract void ResetDevice();
        internal abstract void Dispose(bool disposing);

        public abstract void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertexIndex, int minimumVertexIndex, int verticeCount, int startIndex, int primitiveCount);
        public abstract void SetTexture(string texturePath);


        #endregion


        #region IDisposable Members

        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }

}